<!doctype html>
<html>
<head>
  <title>HTMLFormControlElementWithState eager tracing crash test</title>
  <script src="../../resources/testharness.js"></script>
  <script src="../../resources/testharnessreport.js"></script>
</head>
<body>
  <ul id="list"></ul>
  <script>
    function gc() {
      if (typeof GCController !== "undefined")
          GCController.collect();
      else {
        for (var i = 0; i < 10000; i++) {
            // > force garbage collection
            var s = new String("");
        }
      }
    }

    const numberOfFormControls = 1000;
    var list = document.getElementById("list");
    for(var i = 0; i < numberOfFormControls; i++) {
      var li = document.createElement("li");
      var textField = document.createElement("input");
      textField.value = "Hello world!";
      li.appendChild(textField);
      list.appendChild(li);
    }

    test(() => {
      gc();
      assert_true(true);
    }, "Should not crash during tracing, see https://crbug.com/790739#c5");
  </script>
</body>
</html>
